package com.taotao.controller;

import com.taotao.common.pojo.EasyUIDataGridResult;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.content.service.IContentService;
import com.taotao.pojo.TbContent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhangxiaolin@zhonhajt.com
 * @Title: 内容管理controller
 * @Package com.taotao.controller
 * @Description:
 * @date 2018/10/19 16:14
 */
@Controller
@RequestMapping("/content")
public class ContentController {

    @Autowired
    private IContentService contentService;

    /**
     * 内容列表查询
     * @param categoryId
     * @param page
     * @param rows
     * @return
     */
    @RequestMapping("/query/list")
    @ResponseBody
    public EasyUIDataGridResult getContentList(@RequestParam(value = "categoryId") long categoryId, int page, int rows) {
        EasyUIDataGridResult result = contentService.getContentList(categoryId, page, rows);
        return result;
    }

    @RequestMapping("/save")
    @ResponseBody
    public TaotaoResult saveContent(TbContent tbContent) {
        TaotaoResult result = contentService.saveContent(tbContent);
        return result;
    }
}
